 
import { ABaseDecision } from "GameLoop/DecisionMaking/BaseDecision";
 
import { MineEntity } from "GameLoop/WorldState/EntityManager/Entitys/room/mine/MineEntity";
import { priority } from "utils/constants/definetypes";
import { generateUniqueId } from "utils/utils";
 

/**
 * 检测发布tower治疗任务
 */
export class TowerHealDecision< T extends "tower"="tower"> extends ABaseDecision<T>
{
    public isExpired(event: NormalEvent, region: string): boolean 
    {
        if(event.region != event.room)
        {
            return false
        }
        const room = Game.rooms[event.region] as Required<Room>;
        const towerrasks = room.getTaskByType("tower");
        if(towerrasks.length>0)
        {
            return false;
        }
        if(room.towers().length==0)
        {
            return false
        }
        return true;
    }
    public makeTask(event: NormalEvent, region: string): IDecisionCode<T>|false
    {
        const  Taskarg:IRoomTaskData<"towerHeal"> = 
        {
            type: "towerHeal",
            arg: {
                Creeps:[],
            }
        }
        const code:IDecisionCode<T>={
            region:event.region,
            isunique:false,
            task:[{
                id:generateUniqueId(),
                ttl:5000,
                priority:priority.F,
                type:"tower",
                data:Taskarg,
                shard:0,
            }  ],
        }
        return code
        // return code
    }
     
}